import { registerClass } from "../../../cfw/tools/class_decorator";
import { SDKSystem } from "../../core/system/SDKSystem";
import { sdk_engine } from "../../tools/sdk_engine";
@registerClass('DevSystem')
export class DevSystem extends SDKSystem {
    saveFile(filename: string, content: string) {
        // 创建一个Blob实例，类型为octet/stream
        var blob = new Blob([content], { type: 'application/json;charset=utf-8' });
        // 创建一个指向Blob对象的URL
        var url = URL.createObjectURL(blob);

        // 创建一个a标签
        var link = document.createElement('a');
        link.href = url;
        link.download = filename;

        // 触发下载
        document.body.appendChild(link);
        link.click();

        // 清理并移除元素和URL引用
        document.body.removeChild(link);
        URL.revokeObjectURL(url);
    }

    hasVibration() {
        return false;
    }

    exitApplication(): void {
        sdk_engine.exit();
    }
}